package com.hd.assistant.web.common.util;

import com.hd.assistant.dal.dataobject.User;

public class ClickedUtil {

	public static String PRE_PAIPAI = "P_";
	public static String PRE_TAOBAO = "T_";
	public static String TYPE_TAOBAO = User.Type_TAOBAO;
	public static String TYPE_PAIPAI = User.Type_PAIPAI;
	public static String getClickedId(String type,String itemId){
		String rtn = "";
		if(itemId == null)
			return null;
		if(type.equals(TYPE_PAIPAI)){
			rtn = PRE_PAIPAI+itemId;
		}
		if(type.equals(TYPE_TAOBAO)){
			rtn = PRE_TAOBAO+itemId;
		}
		return rtn;
	}
	
	public static String getItemIdByclickedId(String clicked){
		if(clicked == null)
			return null;
		String rtn = "";
		if(clicked.startsWith(PRE_PAIPAI)){
			rtn = clicked.substring(2);
		
		}
		if(clicked.startsWith(PRE_TAOBAO)){
			rtn = clicked.substring(2);
		}
		return rtn;
	}
}
